package com.basker.pisces.domain.validation.meta;

import org.springframework.util.StringUtils;

import com.basker.pisces.core.Element;

public abstract class Validation extends Element {

    private static final String VALIDATION_SUFFIX = "Validation";
    private static final String VALIDATOR_SUFFIX = "Validator";

    public Validation() {

    }

    public String getValidatorBeanName() {
        String name = StringUtils.uncapitalize(this.getClass().getSimpleName());

        if (name.endsWith(VALIDATION_SUFFIX)) {
            return name.replace(VALIDATION_SUFFIX, VALIDATOR_SUFFIX);
        } else {
            return name + VALIDATOR_SUFFIX;
        }
    }
}
